<template>
    <el-button
      :type="type"
      :disabled="!hasPermission"
      @click="$emit('click')"
    >
      <slot />
    </el-button>
  </template>
  
  <script setup>
  import { computed } from 'vue'
  import { useAuthStore } from '@/stores/auth'
  
  const props = defineProps(['permission', 'type'])
  const authStore = useAuthStore()
  const hasPermission = computed(() => authStore.hasPermission(props.permission))
  </script>